package com.by.common.vo;

import java.util.List;

public class JsonResult {
	private static final int SUCCESS = 1;
	private static final int ERROR = 0;
	/** status */
	private int state = SUCCESS;
	/** msg */
	private String message;
	/** data */
	private Object data;

	public JsonResult() {
		message = "Action OK";
	}

	public JsonResult(Object data) {
		this.data = data;
	}

	public JsonResult(String message) {
		this.message = message;
	}

	public JsonResult(Throwable exp) {
		this.state = ERROR;
		this.message = exp.getMessage();
	}

	public JsonResult(int state, String message) {
		this.state = ERROR;
		this.message = message;
	}

	public JsonResult(int state, String message, boolean flag) {
		this.state = state;
		this.message = message;
		this.data = flag;
	}

	public JsonResult(int state, String message, List<?> data) {
		this.state = state;
		this.message = message;
		this.data = data;
	}

	public int getState() {
		return state;
	}

	public void setState(int state) {
		this.state = state;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}
}
